<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
    <%@include file="/views/common/include/taglib.jsp"%>
    <%@include file="/views/common/include/head.jsp"%>
    <link rel="stylesheet" href="${ctx}/css/page/person.css" type="text/css">
    <link rel="stylesheet" href="${ctx}/css/page/header2.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/page/reset.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/page/person-left.css" type="text/css">
	<link rel="stylesheet" href="${ctx}/css/page/footer.css" type="text/css">
    
    <style>
	.rightlist{
		min-height:755px;
	}
	</style>
	<script type="text/javascript">
		var ctx = '${ctx}';
		function setCtx(ctx){
			this.ctx = ctx;
		}
		setCtx(ctx);
		function gotoPage(page){
			window.location.href = ctx +"/ownerTreasure/ownerIntegralChangeList?pNo=" + page +"&state=" + state;
		}
	</script>	
</head>
<body>
	<jsp:include page="/views/common/head_main.jsp" />
	<div class="bg">
		<div class="contentbox1 contentbox">
			<div class="leftlist">
		        <div class="myorder left">
					<ul>
						<li><a class="order" href="${ctx}/orderInfo/orderInfoListByState" >我的订单</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=0">待付款</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=1">待商家确认</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=2">待发货</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=3,14">待收货</a></li>
						<li><a href="${ctx}/orderInfo/orderInfoListByState?states=6,7,8,10,11,12,13">退款售后</a></li>
					</ul>
				</div>
				<div class="myproperty left">
					<ul>
						<li class="order">我的物业</li>
						<c:if test="${displayFeeBill == 1}">
						<li><a href="${ctx}/propertyBill/getMyBill">我的物业费</a></li>
						</c:if>
						<c:if test="${displayCar == 1}">
						<li><a href="${ctx}/carBill/getCarManage">我的停车费</a></li>
						</c:if>
						<li><a href="${ctx}/propertyRepair/infoList">我的物业报修</a></li>
						<li><a href="${ctx}/propertySuggestion/infoList">我的物业投诉</a></li>
					</ul>
				</div>
				<div class="myassets left">
					<ul>
						<li class="order">我的资产</li>
					    <li><a href="${ctx}/ownerTreasure/ownerIntegralChangeList?state=0&pNo=1">我的积分</a></li>
						<li><a href="${ctx}/ownerTreasure/getCouponList?pNo=1">优惠券</a></li>
					</ul>
				</div>
				<div class="otherlist left">
					<ul class="others">
						<li class="order">其他</li>
						<li><a style="color:red;" href="${ctx}/ownerOther/getMyCollection">我的收藏</a></li>
						<li><a  href="${ctx}/ownerAddress/ownerAddressList">我的收货地址</a></li>
						<li><a href="${ctx}/complaintsInfo/infoList">我的投诉建议</a></li>
						<li><a href="${ctx}/ownerHouse/ownerHouseList">我的小区</a></li>
						<!-- position需要跳转到特定位置 -->
						<li><a href="${ctx}/main?item=1#openShop">我要开店</a></li>
						<li><a href="${ctx}/usualQuestions/infoList">常见问题</a></li>
					</ul>
				</div>
			</div>
			<%-- <jsp:include page="/views/main/main_personal_left.jsp" /> --%>
			<div class="rightlist">
			<input type="hidden" id="item" value="${sessionScope.item_personal}"/>
					<div class="topbox">
						我的收藏
					</div>
					<hr style="border: 1px dashed #57B4C6;width:100%;"/>
					<div class="item-wrap">
						<c:forEach items="${record}" var="item" varStatus="status">
							<div class="item-box-wrap">
								<div class="item-pic-box">
								    	<img width="100" height="100" src="${sessionScope.image_logo}${item.logo}">
								</div>
								<div>
									<input id="ownerId"  type="hidden" value="${sessionScope.user_login.id}">	
									<p>${item.name}</p>
									<p class="text-color" style="margin-bottom:15px;font-size:16px;font-weight:700">￥${item.price}</p>	
									<input type="button" value="加入购物车" class="add-cart" onclick="addToShopCar('${item.name}','${item.goodsId}',
									'${item.shopId}','${item.logo}','${item.price}','${item.type}')">&nbsp;&nbsp;
									<a class="text-color" onclick="removeCollection(${item.goodsId})">取消收藏</a>						
								</div>
							</div>
						</c:forEach>
					</div>
					<div style="background-color: #fff; height: 80px;">
						<table width="100%">
							<tfoot>
								<tr>
									<td colspan="7">
										<div>
											<div style="float: right; width: 20%;">
												<div style="float: left;">
													<ul class="footer_ul">
														<c:if test="${item.hasPreviousPage }">
															<li onclick="gotoPage(${currentPage-1 });"
																style="width: 55px;"><a class="leftRight">&lt;上一页</a></li>
														</c:if>
														<c:if test="${item.firstPage > 1}">
															<li onclick="gotoPage(1);"
																style="width: 24px; text-align: center;"><a>1</a></li>
															<c:if test="${item.firstPage > 2}">
					                        		...
					                        	</c:if>
														</c:if>
														<c:forEach items="${item.navigatepageNums }" var="page">
															<li onclick="gotoPage(${page });"
																class="<c:if test="${currentPage == page }">active</c:if>"
																style="border: 1px solid #9A9A9A; width: 24px; text-align: center;">
																<a>${page}</a>
															</li>
														</c:forEach>
														<c:if test="${item.lastPage < item.pages}">
															<c:if test="${item.firstPage < item.pages - 1}">
					                        		...
					                        	</c:if>
															<li onclick="gotoPage(${item.pages});"
																style="border: 1px solid #9A9A9A; width: 24px; text-align: center;">
																<a>${item.pages}</a>
															</li>
														</c:if>
														<c:if test="${item.hasNextPage }">
															<li style="width: 55px;"><a
																onclick="gotoPage(${currentPage+1});" class="leftRight">下一页&gt;</a></li>
														</c:if>
													</ul>
												</div>
												<%-- <div style="float:left;  height: 30px;">
										<span style="color: #9A9A9A;">跳转到</span> 
										<input class="inputclass" id="pageNo" onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}" type="text" value="${currentPage }" style="width:22px;height:20px;text-align: center;">
										<span style="color: #9A9A9A;">页</span> 
										<span class="buttonclass" id="J_JumpTo" onclick="gotoCellInfoPage(null);"><a>GO</a></span>
									</div> --%>
											</div>
										</div>
									</td>
								</tr>
							</tfoot>
						</table>
					</div>
				</div>
				
			</div>
		</div>
	<jsp:include page="/views/common/footer.jsp" />
	<script type="text/javascript">
	function removeCollection(goodsId) {
		var ownerId =  $('#ownerId').val();
		$.ajax({
			type : "GET",
			url : ctx + "/ownerOther/collectionRemove",
			cache : false,
			dataType : 'json',
			data : {
				ownerId : ownerId,
				goodsId : goodsId
			},
			success : function(result) {
				if (result.success) {
					layer.msg("取消收藏成功", {
						icon : 1,
						time : 3000
					// 2秒关闭（如果不配置，默认是3秒）
					}, function() {
						window.location.href=ctx+"/ownerOther/getMyCollection";
					});
				} else {
					layer.msg("取消收藏失败", {
						icon : 2,
						time : 3000
					});
				}
			}
		});
	}
	
	function addToShopCar(name,goodsId,shopId,logo,price,type) {
		$.ajax({
			type : "POST",
			url : ctx + "/shopcart/addToCart",
			cache : false,
			dataType : 'json',
			data : {
				name     : name,
				goodsId  : goodsId,
				shopId   : shopId,
				logo     : logo,
				price    : price,
				type     : type,
				count    : 1
			},
			success : function(result) {
				if (result.success) {
					layer.msg("加入购物车成功", {
						icon : 1,
						time : 3000
					// 2秒关闭（如果不配置，默认是3秒）
					});
				} else {
					layer.msg("加入购物车失败", {
						icon : 2,
						time : 3000
					});
				}
			}
		});
	}
	</script>
</body>
</html>